package com.wzxy.parse.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wzxy.parse.wx.WxOriginArticle;
import com.wzxy.parse.wx.WxShareArticle;
import com.wzxy.spider.wx.entity.Topic;
import com.wzxy.spider.wx.service.impl.TopicService;

@Service
public class WxParseService {

	@Autowired
	private TopicService topicService;
	@Autowired
	private WxOriginArticle wxOriginArticle;
	@Autowired
	private WxShareArticle wxShareArticle;

	public void start() {
		List<Topic> list = topicService.findAll();
		for (int i = 0; i < list.size(); i++) {
			
			if (!"DONE".equals(list.get(i).getStatus())) {
				/** type: 1.自写 2.分享 */
				if (list.get(i).getType() == 1) {
					wxOriginArticle.startParse(list.get(i));
				} else {
					wxShareArticle.startParse(list.get(i));
				}

			}
		}
	}

}
